﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefOrder_Model" :model="stateOrder_Model.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderType_FormItem" prop="Entity.OrderType" :label="$t('message.autotrans._Model_Order_Model_orderType')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.OrderType" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderCode_FormItem" prop="Entity.OrderCode" :label="$t('message.autotrans._Model_Order_Model_orderCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_Order_Model_orderCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateOrder_Model.vmModel.Entity.OrderCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderQty_FormItem" prop="Entity.OrderQty" :label="$t('message.autotrans._Model_Order_Model_orderQty')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_Order_Model_orderQty')}), trigger: 'blur' }]" >
            <el-input v-model="stateOrder_Model.vmModel.Entity.OrderQty" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Order_Status_FormItem" prop="Entity.Order_Status" :label="$t('message.autotrans._Model_Order_Model_order_Status')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_Order_Model_order_Status')}), trigger: 'blur' }]" >
            <el-select v-model="stateOrder_Model.vmModel.Entity.Order_Status" disabled clearable>
               <el-option key="CREATE" value="CREATE" :label="$t('message.autotrans._Enum_OrderStatus_CREATE')"></el-option>
               <el-option key="ISSUE" value="ISSUE" :label="$t('message.autotrans._Enum_OrderStatus_ISSUE')"></el-option>
               <el-option key="PRODUCE" value="PRODUCE" :label="$t('message.autotrans._Enum_OrderStatus_PRODUCE')"></el-option>
               <el-option key="STOP" value="STOP" :label="$t('message.autotrans._Enum_OrderStatus_STOP')"></el-option>
               <el-option key="CANCEL" value="CANCEL" :label="$t('message.autotrans._Enum_OrderStatus_CANCEL')"></el-option>
               <el-option key="FINISH" value="FINISH" :label="$t('message.autotrans._Enum_OrderStatus_FINISH')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialCode_FormItem" prop="Entity.MaterialCode" :label="$t('message.autotrans._Model_Order_Model_materialCode')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.MaterialCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialId_FormItem" prop="Entity.MaterialId" :label="$t('message.autotrans._Model_Order_Model_materialId')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.MaterialId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialName_FormItem" prop="Entity.MaterialName" :label="$t('message.autotrans._Model_Order_Model_materialName')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.MaterialName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialVersion_FormItem" prop="Entity.MaterialVersion" :label="$t('message.autotrans._Model_Order_Model_materialVersion')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.MaterialVersion" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleCode_FormItem" prop="Entity.ScheduleCode" :label="$t('message.autotrans._Model_Order_Model_scheduleCode')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.ScheduleCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleQty_FormItem" prop="Entity.ScheduleQty" :label="$t('message.autotrans._Model_Order_Model_scheduleQty')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.ScheduleQty" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleEditTime_FormItem" prop="Entity.ScheduleEditTime" :label="$t('message.autotrans._Model_Order_Model_scheduleEditTime')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.ScheduleEditTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleId_FormItem" prop="Entity.ScheduleId" :label="$t('message.autotrans._Model_Order_Model_scheduleId')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.ScheduleId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleStationId_FormItem" prop="Entity.ScheduleStationId" :label="$t('message.autotrans._Model_Order_Model_scheduleStationId')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.ScheduleStationId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MOrderStatus_FormItem" prop="Entity.MOrderStatus" :label="$t('message.autotrans._Model_Order_Model_MOrderStatus')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.MOrderStatus" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_WorkshopCode_FormItem" prop="Entity.WorkshopCode" :label="$t('message.autotrans._Model_Order_Model_workshopCode')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.WorkshopCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_WorkshopName_FormItem" prop="Entity.WorkshopName" :label="$t('message.autotrans._Model_Order_Model_workshopName')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.WorkshopName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" :label="$t('message.autotrans._Model_Order_Model_lineCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_Order_Model_lineCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateOrder_Model.vmModel.Entity.LineCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineName_FormItem" prop="Entity.LineName" :label="$t('message.autotrans._Model_Order_Model_lineName')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.LineName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StationCode_FormItem" prop="Entity.StationCode" :label="$t('message.autotrans._Model_Order_Model_stationCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_Order_Model_stationCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateOrder_Model.vmModel.Entity.StationCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StationName_FormItem" prop="Entity.StationName" :label="$t('message.autotrans._Model_Order_Model_stationName')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.StationName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EquipmentCode_FormItem" prop="Entity.EquipmentCode" :label="$t('message.autotrans._Model_Order_Model_equipmentCode')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.EquipmentCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StartTime_FormItem" prop="Entity.StartTime" :label="$t('message.autotrans._Model_Order_Model_startTime')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.StartTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EndTime_FormItem" prop="Entity.EndTime" :label="$t('message.autotrans._Model_Order_Model_endTime')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.EndTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_FactoryCode_FormItem" prop="Entity.FactoryCode" :label="$t('message.autotrans._Model_Order_Model_factoryCode')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.FactoryCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field1_FormItem" prop="Entity.Field1" :label="$t('message.autotrans._Model_Order_Model_field1')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.Field1" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field2_FormItem" prop="Entity.Field2" :label="$t('message.autotrans._Model_Order_Model_field2')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.Field2" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field3_FormItem" prop="Entity.Field3" :label="$t('message.autotrans._Model_Order_Model_field3')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.Field3" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field4_FormItem" prop="Entity.Field4" :label="$t('message.autotrans._Model_Order_Model_field4')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.Field4" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field5_FormItem" prop="Entity.Field5" :label="$t('message.autotrans._Model_Order_Model_field5')">
            <el-input v-model="stateOrder_Model.vmModel.Entity.Field5" disabled clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onCloseOrder_Model"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageBaseInformationOrder_ModelDetails;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { order_modelApi } from '/@/api/baseinformation/order_model';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefOrder_Model = ref();
const stateOrder_Model = reactive({
    vmModel: {
	  Entity:{
        OrderType: '',
        OrderCode: '',
        OrderQty: '',
        Order_Status: undefined,
        MaterialCode: '',
        MaterialId: '',
        MaterialName: '',
        MaterialVersion: '',
        ScheduleCode: '',
        ScheduleQty: '',
        ScheduleEditTime: '',
        ScheduleId: '',
        ScheduleStationId: '',
        MOrderStatus: '',
        WorkshopCode: '',
        WorkshopName: '',
        LineCode: '',
        LineName: '',
        StationCode: '',
        StationName: '',
        EquipmentCode: '',
        StartTime: '',
        EndTime: '',
        FactoryCode: '',
        Field1: '',
        Field2: '',
        Field3: '',
        Field4: '',
        Field5: '',
        ID:null,
      },

	},
    
});

// 取消
const onCloseOrder_Model = () => {
    closeDialog();
};

// 提交
const onSubmitOrder_Model = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefOrder_Model.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            order_modelApi().edit(stateOrder_Model.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};

// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		stateOrder_Model.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateOrder_Model.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	order_modelApi().get(stateOrder_Model.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateOrder_Model.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

